package com.conjane.algo.binary_search_tree;

import com.conjane.algo.printer.BinaryTrees;

public class BinarySearchTreeTest {
    public static void main(String[] args) {
        BinarySearchTree<Integer> binarySearchTree = new BinarySearchTree<>();
        binarySearchTree.add(7);
        binarySearchTree.add(8);
        binarySearchTree.add(1);
        binarySearchTree.add(9);
        binarySearchTree.add(4);
        binarySearchTree.add(12);
        binarySearchTree.add(3);
        BinaryTrees.print(binarySearchTree);
        System.out.println("\n利用栈前序遍历为----");
        binarySearchTree.preOrderWithStack();
        System.out.println("\n利用递归前序遍历为----");
        binarySearchTree.preOrder();
        System.out.println("\n利用栈中序遍历为----");
        binarySearchTree.inOrderWithStack();
        System.out.println("\n利用递归中序遍历为----");
        binarySearchTree.inOrder();
        System.out.println("\n利用栈后序遍历为----");
        binarySearchTree.postOrderWithStack();
        System.out.println("\n利用递归后序遍历为----");
        binarySearchTree.postOrder();
    }
}
